﻿using System;
using System.Collections.Generic;
using System.Text;

namespace xFeedTest
{
    class Program
    {
        static void Main(string[] args)
        {
            BSL.objConfigBehaviour obj = new xFeedTest.BSL.objConfigBehaviour();
            DAL.objConfig[] configs = obj.getListConfigObjectInTime();
            foreach (DAL.objConfig c in configs)
            {
                Lib.Crawler.LinkPatternCrawling lpc = new Lib.Crawler.LinkPatternCrawling(c.ConfigLinkEx, c.ConfigDataEx);
                lpc.CrawlLinks(c.ConfigWebsite, string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["StorePath"])?"C:\\xFeed\\Data":System.Configuration.ConfigurationManager.AppSettings["StorePath"]);
            }
            try
            {
                string tableToFeed = "";
                string filePath = "";
                string categoryColumnName = "";

                tableToFeed = System.Configuration.ConfigurationManager.AppSettings["SQLTable"];
                filePath = System.Configuration.ConfigurationManager.AppSettings["StorePath"];
                categoryColumnName = System.Configuration.ConfigurationManager.AppSettings["CateColName"];
                Lib.Integration.IntegrateAllXML.IntegrateXMLToSQL(string.IsNullOrEmpty(categoryColumnName) ? "CategoryID" : categoryColumnName, string.IsNullOrEmpty(tableToFeed) ? "News" : tableToFeed, System.Configuration.ConfigurationManager.ConnectionStrings["xFeedTest.Properties.Settings.SQLConnection"].ConnectionString, string.IsNullOrEmpty(filePath) ? "C:\\xDataFeed\\Data" : filePath);
            }
            catch { }
        }
    }
}
